package com.emergency.db.dao.item;

import com.emergency.db.domain.item.HugeItemStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface HugeItemStatusDao extends JpaRepository<HugeItemStatus, Long>, JpaSpecificationExecutor<HugeItemStatus> {
    @Modifying
    @Query(value = "delete FROM bas_huge_status WHERE item_id = ? ", nativeQuery = true)
    void deleteAllByItem(Long id);

    @Query("select his from HugeItemStatus his where item.id=:id ")
    List<HugeItemStatus> findAllByItem(@Param("id") Long id);
}
